﻿using ICAM.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ICAM.View
{
    /// <summary>
    /// AlaramInfoTotalView.xaml 的交互逻辑
    /// </summary>
    public partial class AlaramInfoTotalView : UserControl, INotifyPropertyChanged
    {
        public AlaramInfoTotalView()
        {
            InitializeComponent();
            //this.DataContext = this;
            //InitData();
        }


        private ObservableCollection<AlarmInfo> _alaramInfos = new ObservableCollection<AlarmInfo>();
        public ObservableCollection<AlarmInfo> AlaramInfos
        {
            get { return this._alaramInfos; }
            set {
                this._alaramInfos = value;
                OnPropertyChanged("AlaramInfos");
            }
        }

        private void InitData()
        {
            AlarmInfo alarmInfo1 = new AlarmInfo() {
                AlarmID = "1",
                AlarmLatestPhotoUrl = "pack://application:,,,/Resource/Images/test.png",
                AlarmObjInfo = "陌生人",
                AlarmTypeName = "陌生人逗留",
                AlarmTime = "2019年8月9日\r\n22:30",
                AlarmLevel = "1级",
                Location="小区后门口\r\n1栋2单元",
                AlarmDealTime= "2019年8月9日\r\n22:30",
                AlarmDealPeople="张三",
                AlarmDealStatus="已忽略"
            };
            AlarmInfo alarmInfo2 = new AlarmInfo()
            {
                AlarmID = "2",
                AlarmLatestPhotoUrl = "pack://application:,,,/Resource/Images/test.png",
                AlarmObjInfo = "陌生人",
                AlarmTypeName = "陌生人逗留",
                AlarmTime = "2019年8月9日\r\n22:30",
                AlarmLevel = "1级",
                Location = "小区后门口\r\n1栋2单元",
                AlarmDealTime = "2019年8月9日\r\n22:30",
                AlarmDealPeople = "张三",
                AlarmDealStatus = "已忽略"
            };

            AlarmInfo alarmInfo3 = new AlarmInfo()
            {
                AlarmID = "3",
                AlarmLatestPhotoUrl = "pack://application:,,,/Resource/Images/test.png",
                AlarmObjInfo = "陌生人",
                AlarmTypeName = "陌生人逗留",
                AlarmTime = "2019年8月9日\r\n22:30",
                AlarmLevel = "1级",
                Location = "小区后门口\r\n1栋2单元",
                AlarmDealTime = "2019年8月9日\r\n22:30",
                AlarmDealPeople = "张三",
                AlarmDealStatus = "已忽略"
            };
            AlaramInfos.Add(alarmInfo1);
            AlaramInfos.Add(alarmInfo2);
            AlaramInfos.Add(alarmInfo3);
        }



        /// <summary>
        /// Occurs when a property value changes.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Raises the PropertyChanged event.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        protected virtual void OnPropertyChanged(string propertyName)
        {
            var handler = this.PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private void pager_PaginatorSelected(object sender, RoutedPropertyChangedEventArgs<int> e)
        {
            Paginator paginator = (Paginator)sender;
            int page = paginator.CurrentPage;
            //MessageBox.Show("你点击了第" + page.ToString() + "页");
        }
    }
}
